There is known a printer that forms a wireless network by shifting from a device state to a Group Owner state (hereinafter referred to as a “G/O state”) in the WFD (an abbreviation for Wi-Fi Direct (Trademark)) scheme. When the number of apparatuses in a client state that are participating in the wireless network becomes zero, the printer determines a termination timing of a maintenance period for maintaining the G/O state. When the termination timing of the maintenance period arrives, the printer shifts from the G/O state to the device state and causes the wireless network to disappear. On the other hand, the printer, in the case of receiving a connection request from a target apparatus before the termination timing of the maintenance period arrives, establishes a wireless connection with the target apparatus by performing a connection process. Consequently, the target apparatus participates in the wireless network, and hence the printer can execute a wireless communication with the target apparatus by using the wireless network.